#ifndef ROV_UTIL_H
#define ROV_UTIL_H


#include <termios.h>


// Same as unix read(int, void *, size_t)
// except reads until count bytes are read.
// Less than count bytes might be read if
// there is an IO error (e.g. fd gets closed).
// Returns the amount of bytes read.
int readAll(int fd, char * buf, int count);


// Returns 1 if the data read from the
// device matches the data in id.
// id should be null terminated.
int checkMatches(int fd, char const * const id);


// Configure a serial connection.
// returns 0 on success
int configSerial(int fd, speed_t baudRate);


#endif
